<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
     xmlns:h="http://java.sun.com/jsf/html"
     xmlns:ui="http://java.sun.com/jsf/facelets"
     xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
     template="../../Template.xhtml"
>
<ui:define name="title">Add category</ui:define>

<ui:define name="body">

<h:form>
	<p:panelGrid columns="2">
<h2>Add New Station</h2>
<p:commandButton value="Back" action="ManageStations.xhtml" />
</p:panelGrid>
</h:form>
<br/><br/><br/><br/>
<h:form>

<p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />

	<p:panelGrid columns="2">
		<p:outputLabel value="Station Name :"/>
	   <p:inputText value="#{stationMB.station.intitule}" />
	   <p:outputLabel value="country :"/>
	   <p:selectOneMenu  id="countryu" value="#{stationMB.idC}" style="width:150px"   >
                <p:ajax listener="#{stationMB.onCountryChange()}" update="Stateu" />
                <f:selectItem itemLabel=" Country" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{stationMB.listPays}" var="a" itemValue="#{a.idPays}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
            
            
	<p:outputLabel value="State :"/>
	  <p:selectOneMenu id="Stateu" value="#{stationMB.idS}" style="width:150px"  >
               <p:ajax listener="#{stationMB.onStateChange()}" update="cityu" />
                 <f:selectItem itemLabel="State" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{stationMB.listeEtat}"  var="s" itemValue="#{s.idEtat}"  itemLabel="#{s.intitule}"/>
            </p:selectOneMenu>
          
            
          <p:outputLabel value="City :"/>
		  <p:selectOneMenu id="cityu" value="#{stationMB.idCi}" style="width:150px"   >
                <f:selectItem itemLabel="City" itemValue="" noSelectionOption="true" />
                <f:selectItems value="#{stationMB.listeVille}" var="a" itemValue="#{a.idVille}" itemLabel="#{a.intitule}" />
            </p:selectOneMenu>
               
	   <p:outputLabel value="zipcode :"/>
	   <p:inputText value="#{stationMB.station.codePostal}" />
	   
	   
		<p:outputLabel value="Status :" />
		<p:selectOneMenu value="#{stationMB.station.statut}" >
			<f:selectItem  itemValue="true" itemLabel="Active"  />
			<f:selectItem  itemValue="false" itemLabel="Inactive"  />
		</p:selectOneMenu><br/>
		<p:commandButton ajax="false" action="#{stationMB.Ajouter(0)}" value="Add" ></p:commandButton>
	</p:panelGrid>
</h:form>
</ui:define>
</ui:composition>